import request from '@/utils/request.js'

// 请求商品详情数据,参数是商品ID
export const findGoods = (id) => {
  return request('/goods', 'get', { id })
}

// 请求商品详情的推荐商品以及喜欢商品数据，参数是商品ID、商品总数
export const findRelevantGoods = ({ id, limit = 16 }) => {
  return request('/goods/relevant', 'get', { id, limit })
}

// 请求热销榜数据，参数是商品ID、商品数、榜单类型
export const findGoodsHot = ({ id, limit = 3, type = 1 }) => {
  return request('/goods/hot', 'get', { id, limit, type })
}

// 请求商品评价选项数据
export const findGoodsCommentInfo = (id) => {
  // return request(`/goods/${id}/evaluate`, 'get')
  // axios 遇见 http https 开头的地址，不会加上基准地址
  return request(`https://mock.boxuegu.com/mock/1175/goods/${id}/evaluate`, 'get')
}

// 请求商品评价列表数据
export const findGoodsCommentList = (id, params) => {
  return request(`https://mock.boxuegu.com/mock/1175/goods/${id}/evaluate/page`, 'get', params)
}
